<template>
    <div class="card-record">

      <section class="header">
        <h2>-{{resData.payment}}</h2>
        <h3>支付金额 (元)</h3>
      </section>

      <section class="main">
        <div>
          <span>付款方式</span><span>{{resData.pay_type}}</span>
        </div>
        <div v-if="!balance_pay">
          <span>微信流水单号</span><span>{{resData.pay_trade_no}}</span>
        </div>
        <div>
          <span>订单号</span><span>{{resData.card_order_no}}</span>
        </div>
        <div>
          <span>支付时间</span><span>{{resData.pay_time}}</span>
        </div>

      </section>
      <div class="button">
        <van-button
          @click="clickJump()"
          class="btn red-btn"
          round
          block
          >查看详情</van-button
        >
      </div>
    </div>
</template>

<script>
import { reqGetCardTradeInfo } from '@/api/user/member/memberApi'
import Vue from 'vue'
export default Vue.extend({
  data() {
    return {
      orderItemId: '',
      resData: ''
    }
  },
  created() {
    this.orderItemId = this.$route.query.card_order_id
    this.balance_pay = this.$route.query.balance_pay
    this.init()
  },
  methods: {
    clickJump() {
      this.$JumpPath(this, 'cardDetail')
    },
    init() {
      this.$loadingWrap.show()
      setTimeout(() => {
        this.$loadingWrap.close()
      }, 10000)

      reqGetCardTradeInfo({
        'card_order_id': this.orderItemId
      }).then(res => {
        if (res.status === 1) {
          this.resData = res.data
        } else {
          this.$Error(res.msg)
        }

        this.$nextTick(_ => {
          this.$loadingWrap.close()
        })
      }).catch(_ => {})
    }
  }
})
</script>

<style lang="scss">
@import "src/styles/mixin";
@import "src/styles/publicSuccess/index";

  .card-record {
    position: fixed;
    width: 100%;
    height: 100%;
    background-color: white;

    .header {
      padding-top: 77px;
      margin-bottom: 100px;
      color: #333;
      h2 {
        margin-bottom: 27px;
        text-align: center;
        font-size: 60px;
        font-weight: bold;
      }
      h3 {
        text-align: center;
        font-size: 28px;
      }
    }

    .main{
      div {
        display: flex;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        font-size: 26px;
        padding: 25px 30px;

        span:first-child {
          color: #666;
        }
        span:last-child {
          color: #333;
          font-weight: bold;
        }
      }
    }

  }
</style>